#include <iostream>
#include <cmath>
//#include <stack>

using namespace std;

void Hanoi(int n, char a, char b, char c);
void Move(int n, char a, char b);
long long count;
long long sum=1;
int main()
{
    ios::sync_with_stdio(false);
    int n = 8;
    cin >> n;
    for(int i=0; i<n;i++)
    {
        sum*=2;
    }
    sum--;
    Hanoi(n, 'A', 'B', 'C');
    //system("pause");
    return 0;
}
void Hanoi(int n, char a, char b, char c)
{
    if (n == 1)
    {
        Move(n, a, c);
    }
    else
    {
        Hanoi(n - 1, a, c, b);
        Move(n, a, c);
        Hanoi(n - 1, b, a, c);
    }
}
void Move(int n, char a, char b)
{
    count++;
    cout << a << "->" << b;
    if(count != sum)
    {
        cout << endl;
    }
}